home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue30 / bdeorx / BDEDORX.ZIP / Bdedorxs.int < prev   
Encoding:
Text File  |  1997-12-26  |  7.3 KB  |  203 lines

  1.  
  2.  Demo of using DBIDoRestructure on the field definitions of
  3.  Paradox and dBase tables from within Delphi v1 and v2. 
  4.  
  5.  Unzip with otion -d to preserve directories. To compile the samples
  6.  copy BDEDoRxS.DCU from the appropriate subdir to your project dir or 
  7.  include it in your COMPLIB's aearch path (since it doesn't include
  8.  any objects that need to be registered it doesn't need to be in the
  9.  COMPLIB's path).
  10.  
  11.  
  12.  The demo project BDEDoRx (for more samples cf OLH):
  13.  
  14.  In the structure grid, Ctrl-Ins inserts a row, Ctrl-DEL deletes
  15.  and Ctrl-Down or Ctrl-PgDn adds one. Moving fields is done
  16.  by mouse drag and drop. There's not much validation coded here,
  17.  you will have to make sure yourself to supply valid field data.
  18.  The interface field data is taken from the DBD concept here but
  19.  it should be easy to rewrite the FLDDescToList and ListToFLDDesc
  20.  procs to fit any other terminology (that's one reason why I didn't
  21.  merge these procs with GetOpAndPos).
  22.  
  23.  
  24.  The restructure unit BDEDoRxS.DCU:
  25.  
  26.  You might want to set up your own demo to evaluate the handling
  27.  of this unit. 
  28.  
  29.  This unit is using two dialog forms (BDEDoRxT for getting the trim
  30.  options if field data may have to be truncated and BDEDoRxP for
  31.  showing progress info when restructuring large tables). You can
  32.  modify the text of BDEDoRxT by directly entering it in it's memo
  33.  component. Set the const 'FieldLineIndex' to the index of the line
  34.  that is to hold the name of the field in question. The text for
  35.  BDEDoRxP is directly supplied by the BDE, however you can set up
  36.  const 'ProgressDlgLastMessage' to display some custom text when
  37.  the restructuring is finished.
  38.  
  39.  All interface info on BDEDoRxS is at the beginning of the sample
  40.  project file BDEDoRx1.PAS. 
  41.  
  42.  
  43.  You may not use this code unless otherwise granted by the
  44.  author. Drop me a mail.
  45.  
  46.  (c) May 1996,
  47.  Reinhard Kalinke
  48.  100417,3504 @compuserve.com
  49.  
  50.  
  51.  Here's at least a list of currently available methods (doc to follow):
  52.  
  53.  type
  54.   EDoRxError = class(Exception) {generic error type}
  55.   private
  56.     FTableName: TFileName;
  57.     procedure SetTableName(Value: TFileName);
  58.   public
  59.     property TableName: TFileName read FTableName write SetTableName;
  60.   end;
  61.  
  62.   EDoRxProblem = class(EDoRxError); {raised when problem or keyviol}
  63.   EDoRxKeyViol = class(EDoRxError); {tables are created, name will be}
  64.                                     {in the TableName property}
  65.  
  66.  type {simple TList descendant that can free its objects}
  67.   TDoRxList = class(TList)
  68.   public
  69.     procedure FreeAll;
  70.   end;
  71.  
  72.  {here are three ways to get the location
  73.  of a table/database:
  74.  No1 is for permanent BDE aliases only,
  75.  No2 works on BDE and local aliases
  76.  and No3 works with BDE and local aliases
  77.  as well as with tables with a hardcoded
  78.  path, using DBI calls}
  79.  function BDEGetDBPath1(AliasName: string): TFileName;
  80.  
  81.  function BDEGetDBPath2(AliasName: string): TFileName;
  82.  
  83.  function BDEGetDBPath3(ATable: TTable): TFileName;
  84.  
  85.  procedure BDESaveTableDefsToFile(ATable: TTable;
  86.                               const FileName: TFileName);
  87.  
  88.  procedure BDERestructTableFromFile(ATable: TTable;
  89.                               const FileName: TFileName);
  90.  
  91.  procedure BDECreateTableFromFile(ADataBase: TDataBase;
  92.                               const FileName: TFileName);
  93.  
  94.  procedure BDEAddIndicesFromFile(ATable: TTable;
  95.                               const FileName: TFileName);
  96.  
  97.  procedure BDERecoverIndicesFromFile(ADB: TDataBase;
  98.                     const ATableName, FileName: TFileName);
  99.  
  100.  
  101.  procedure BDESaveIndexDefsToFile(ATable: TTable;
  102.                               const FileName: TFileName);
  103.  
  104.  procedure BDEDropAllIndices(ATable: TTable);
  105.  
  106.  procedure BDEEmergencyDropAllIndices(ADB: TDataBase;
  107.                                    ATableName: string);
  108.  
  109.  procedure BDEGetFieldStructure(ATable: TTable;
  110.                                AFieldDescList: TDoRxList);
  111.  
  112.  procedure BDEFieldRestruct(ATable: TTable;
  113.                            AFieldDescList: TDoRxList;
  114.                            AskForTrim: boolean;
  115.                            ShowProgrThreshold: longint);
  116.  
  117.  procedure BDEOptRestruct(ATable: TTable; const OptNames,
  118.                          OptValues: array of string);
  119.  
  120.  procedure BDEPdoxCreate(ADataBase: TDataBase;
  121.                         const ATableName: TFileName;
  122.                         AFieldDescList: TDoRxList;
  123.                         const ATableLevel, ABlockSize: word;
  124.                         const StrictRI: boolean;
  125.                         const LangDrv: string);
  126.  
  127.  procedure BDEdBaseCreate(ADataBase: TDataBase;
  128.                          const ATableName: TFileName;
  129.                          AFieldDescList: TDoRxList;
  130.                          const ATableLevel, AMDXBlockSize,
  131.                          AMemoBlockSize: word;
  132.                          const LangDrv: string);
  133.  
  134.  procedure BDETableCreate(ADataBase: TDataBase;
  135.                          const ATableName: TFileName;
  136.                          const ATableType: TTableType;
  137.                          AFieldDescList: TDoRxList;
  138.                          const OptNames,
  139.                          OptValues: array of string);
  140.  
  141.  procedure BDECloneTable(ATable: TTable;
  142.                         ADataBase: TDataBase; {}
  143.                         const ANewTableName: TFileName;
  144.                         const APassword: TCaption;
  145.                         KeepRI: boolean);
  146.  
  147.  procedure BDEGetOptParams(ATableType, AOptionName: TCaption;
  148.                           var OptionValue: TCaption);
  149.  
  150.  procedure BDEAddRIConstraint(ATable: TTable;
  151.                              const OtherTable: TFileName;
  152.                              const RIName: TCaption;
  153.                              const RIModeOp, RIDelOp: RINTQual;
  154.                              const StrictRI: boolean;
  155.                              const ThisTableFields,
  156.                              OtherTableFields: string);{}
  157.  
  158.  procedure BDEDropRIConstraint(ATable: TTable;
  159.                               const ARIName: string);
  160.  
  161.  procedure BDEDropAllRIConstraints(ATable: TTable);
  162.  
  163.  procedure BDEGetRIList(ATable: TTable; AList: TStrings);
  164.  
  165.  procedure BDEGetRIDefsByName(ATable: TTable;
  166.                              const ARIName: string;
  167.                              ARIDefs: TStrings);
  168.  
  169.  procedure BDEGetRIDefsByNumber(ATable: TTable;
  170.                                const ARINumber: smallint;
  171.                                ARIDefs: TStrings);
  172.  
  173.  procedure BDEAddRIFromFile(ATable: TTable; 
  174.                            const FileName: TFileName);
  175.  
  176.  procedure BDEAddValchecksFromFile(ATable: TTable; 
  177.                                   const FileName: TFileName);
  178.  
  179.  procedure BDEGetValchecksByNumber(ATable: TTable;
  180.                                   const AVchkNumber: smallint;
  181.                                   AValDefs: TStrings);
  182.  
  183.  procedure BDEDropValcheckByNumber(ATable: TTable; 
  184.                                   AValNumber: integer);
  185.  
  186.  procedure BDEDropAllValchecks(ATable: TTable);
  187.  
  188.  procedure BDEDropValFile(ATable: TTable);
  189.  
  190.  procedure BDEAlterPrimary(ATable: TTable; const AIndexFields: string;
  191.                           const AIdxOptions: TIndexOptions);
  192.  
  193.  function BDEGetIdapi16Version: string;
  194.  
  195.  {$IFDEF WIN32}
  196.  function BDEGetIdapi32Version: string;
  197.  {$ENDIF}
  198.  
  199.  procedure CalcControlSize(Sender: TObject);
  200.  
  201.  procedure CalcCenterPos(ParentForm, ClientForm: TForm);
  202.  
  203.